<?php
include_once('common/header.php');	
if($AppUI->id < 0) {
	Vfriend_Function::redirect(HOST_VFRIEND);
}	
$strRefer		= isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$intHexId		= $objRequest->getParam('userid',0);
$strToken		= $objRequest->getParam('token','');
$strTok			= $intHexId . '_' . $AppUI->id;
$strSession		= isset($_SESSION['fullhouse' . $strTok]) ? $_SESSION['fullhouse' . $strTok] : '';
$intError		= 0;
$strUsername	= '';
if($intHexId && $strToken != '' && $strSession != '' && $strToken == $strSession && Vfriend_Function::isValidLink($strRefer)) {
	unset($_SESSION['fullhouse' . $strTok]);
	$objVfriendUser	= new Vfriend_User();
	$objUser		= $objVfriendUser->getInfoByHexUserId($intHexId);
	if($objUser) {
		if($objUser->id != $AppUI->id) {
			$strUsername	= $objUser->fullnamevn;
			$intError		= $objVfriendUser->addLike($objUser->id,$AppUI->id);
			if($intError == 0) {
				$strMessage	= $arrMessage[3];
				$strMessage	= str_replace('[strUsername]',$strUsername,$strMessage);
				Vfriend_Function::setMsg($strMessage);
			} else $intError += 5;
		} else {
			$intError = 5;
		}
	} else {
		$intError 	= 4;
	}
} else {
	$intError = 4;
}
if($intError > 0) {
	$strError	= $arrError[$intError];
	$strError	= str_replace('[strUsername]', $strUsername, $strError);
	Vfriend_Function::setError($strError);
}
Vfriend_Function::redirect(isset($strRefer) ? $strRefer : HOST_VFRIEND);
?>